	# extract from Serial.pm
	package Serial;
	use strict;
	
	use Carp;
	
		my %conf = (
	   'start' => 1,
	   'increment' => 1,
	);

		# part of xxx_serial2/Serial.pm 
	sub new {
	   my $class = (ref $_[0]) || $_[0];
	   $conf{'start'} = $_[1] if defined $_[1];
	
	   my $self = bless {}, $class;
	   $self->{'serial'} = $conf{'start'};
	   $self->{'_next'} = \$conf{'start'};
	   $self->{'_incr'} = \$conf{'increment'};
	   $conf{'start'} += $conf{'increment'};
	   return $self;
	}

	
	sub serial {
	   return shift->{'serial'};
	}
		# extract from Serial.pm
	sub configure {
	   my $class = shift;
	   return unless @_;
	   while (my ($key, $value) = (shift, shift)) {
	      $key =~ /start/ and $conf{'start'} = int($value), last;
	      $key =~ /increment/ and do {
	         $value = int($value);
	         croak "Invalid value '$_'" unless $value;
	         $conf{'increment'} = $value;
	         last;
	      };
	      croak "Invalid name '$key' in import list";
	   }
	}
	sub next ($;$) {
	   my ($self, $new) = @_;
	   ${$self->{'_next'}} = $new if $new;
	   return ${$self->{'_next'}};	
	}

	1;
